import { TOKEN } from '@/common/const';
import storage from '@/utils/storage';
import { useEffect, useState } from 'react';
import { useHistory } from 'umi';

export default () => {
  const history = useHistory();
  const [t, setT] = useState({});
  const query = (history.location as any)?.query ?? {};
  useEffect(() => {
    if (query.token) {
      const value = { value: query.token };
      storage.set(TOKEN, value);
      setT(value);
    }
  }, []);

  return <div>{JSON.stringify(t)}</div>;
};
